sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
Download repository key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add repository
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Update repositories
sudo apt update
Install docker
sudo apt install docker-ce
Run this for the latest LTS build:
sudo docker run`-i -t -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home/:/var/jenkins_home --env jenkinsci/jenkins:lts
or this for the latest build:
sudo docker run`-i -t -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home/:/var/jenkins_home --env jenkinsci/jenkins
When you're running jenkins inside a subdirectory (https://example.com/jenkins) you have to use this line:
sudo docker run`-i -t -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home/:/var/jenkins_home --env JENKINS_OPTS="--prefix=/jenkins" jenkinsci/jenkins:lts
If you want an output you have to amend the parameters "-i -t -d".
Now you can connect to jenkins trough port 8080. The configuration is located at /var/jenkins_home.
To restart Jenkins manually, you can use either of the following commands:
Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/safeRestart
Forces a restart without waiting for builds to complete.
(jenkins_url)/restart
sudo screen -S jenkins docker run -p 8080:8080 -p 50000:50000 -v /var/jenkins_home/:/var/jenkins_home --env JENKINS_OPTS="--prefix=/jenkins" jenkinsci/jenkins:lts
sudo screen -r jenkins
sudo docker exec -it 11c99221f2f34c5976b2680a2c19b352e089268cb5df6f6c3a299c7015ec40ea git config --global http.sslVerify "false"